<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>彩色旋转头像框</title>
</head>

<body>


    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            background: black;
        }

        .head-portrait {
            border-radius: 50%;
            width: 200px;
            height: 200px;
            position: relative;
            overflow: hidden;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .head-portrait::after {
            content: "";
            width: 190px;
            height: 190px;
            background: url(1.jpg);
            border-radius: 50%;
            display: flex;
            justify-content: center;
            align-items: center;
            position: absolute;
            font-size: larger;
            letter-spacing: 5px;
        }

        .frame {
            width: 30rem;
            height: 30rem;
            position: absolute;
            display: flex;
            justify-content: center;
            align-items: center;
            animation: rotate 4s linear infinite;
        }

        .frame span {
            width: 30rem;
            height: 15rem;
            background: linear-gradient(red, orange, yellow, green, blue, purple, pink);
            position: absolute;
        }

        @keyframes rotate {
            100% {
                transform: rotate(-360deg);
            }
        }
    </style>
    <div class="head-portrait">
        <div class="frame">
            <span></span>
        </div>
    </div>
</body>

</html>